package com.jzt.ic.service;

import com.jzt.model.Merchandise;
import com.jzt.service.MerchandiseService;
import com.jzt.service.ServiceA;
import com.jzt.service.ServiceB;
import com.jzt.service.ServiceC;
import com.yvan.dsf.anno.DsfConsumer;
import com.yvan.dsf.anno.DsfService;
import org.joda.time.DateTime;

/**
 * Created by luoyifan on 2017/11/21.
 */
@DsfService
public class MerchandiseServiceImp implements MerchandiseService {

    @DsfConsumer
    private ServiceA serviceA;

    @DsfConsumer
    private ServiceB serviceB;

    @DsfConsumer
    private ServiceC serviceC;

    @Override
    public Merchandise getById(Long id) {
        if (id <= 0 || id > 100) {
            return null;
        }
        Merchandise merchandise = new Merchandise();
        merchandise.setId(id);
        merchandise.setCode("A" + id);
        merchandise.setName("商品" + id);
        merchandise.setUpdateTime(DateTime.now());
        merchandise.setCreateTime(DateTime.now());
        return merchandise;
    }

    @Override
    public String test(String aa) {
        return aa;
    }

    @Override
    public String invokeABC() {
        return serviceA.linkABC();
    }

    @Override
    public String invokeBA() {
        return serviceB.invokeA(":");
    }

    @Override
    public String invokeC() {
        return serviceC.cFinish(":");
    }
}
